<template>
  <div class="calltheroll-component">
    <div class="tabs-box">
      <wx-table
        ref="table"
        size="default"
        :hiddenSearch="true"
        :hidenOpt="true"
        :pagination="false"
        :rowKey="(record, index) => index"
        :columns="columns"
        :data="loadData"
        style="flex: 1; height: 0; overflow-y: auto;"
      >
      </wx-table>
      <div class="button-group">
        <a-button type="primary">
          发送
        </a-button>
        <a-button
          @click="$emit('close')"
        >
          取消
        </a-button>
      </div>
    </div>
  </div>
</template>

<script>
import { WxTable } from '@/components'
export default {
  data () {
    return {
      columns: [
        {
          title: '指令类型',
          dataIndex: 'type'
        },
        {
          title: '状态',
          dataIndex: 'status'
        },
        {
          title: '应答/指令内容',
          dataIndex: 'replay'
        },
        {
          title: '时间',
          dataIndex: 'time'
        }
      ],
      loadData: parameter => {
        const requestParameters = Object.assign({}, parameter, this.queryParam)
        console.log('loadData request parameters:', requestParameters)
        return new Promise((resolve, reject) => {
          const retData = {
            code: 200,
            message: '操作成功',
            data: {
              amount: 2,
              list: [
                {
                  id: 1,
                  type: '设备点名',
                  status: '已返回',
                  replay: 'nJ2enwASACASAAAAAABFxQAA',
                  time: '2021-02-20 00:00:00'
                }
              ]
            }
          }
          resolve(retData)
        })
      }
    }
  },
  components: {
    WxTable
  },
  methods: {
    filterOption (input, option) {
      return (
        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
      )
    }
  }
}
</script>

<style lang="less" scoped>
@import url('./CallTheRoll.less');
</style>
